import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TopicTypeVO, TopicTypeForm, TopicTypeQuery } from '@/api/kitchen/topicType/types';

/**
 * 查询美食分类类型列表
 * @param query
 * @returns {*}
 */

export const listTopicType = (query?: TopicTypeQuery): AxiosPromise<TopicTypeVO[]> => {
  return request({
    url: '/kitchen/topicType/list',
    method: 'get',
    params: query
  });
};


/**
 * 查询美食分类类型列表
 * @param query
 * @returns {*}
 */

export const listNoPageTopicType = (query?: TopicTypeQuery): AxiosPromise<TopicTypeVO[]> => {
  return request({
    url: '/kitchen/topicType/noPage/list',
    method: 'get',
    params: query
  });
};



/**
 * 查询美食分类类型详细
 * @param id
 */
export const getTopicType = (id: string | number): AxiosPromise<TopicTypeVO> => {
  return request({
    url: '/kitchen/topicType/' + id,
    method: 'get'
  });
};

/**
 * 新增美食分类类型
 * @param data
 */
export const addTopicType = (data: TopicTypeForm) => {
  return request({
    url: '/kitchen/topicType',
    method: 'post',
    data: data
  });
};

/**
 * 修改美食分类类型
 * @param data
 */
export const updateTopicType = (data: TopicTypeForm) => {
  return request({
    url: '/kitchen/topicType',
    method: 'put',
    data: data
  });
};

/**
 * 删除美食分类类型
 * @param id
 */
export const delTopicType = (id: string | number | Array<string | number>) => {
  return request({
    url: '/kitchen/topicType/' + id,
    method: 'delete'
  });
};
